import { Component, OnInit, Input } from '@angular/core';
import { AppGlobalService } from "./../../shared/service/app-global.service";

@Component({
  selector: 'app-success-investment',
  templateUrl: './success-investment.component.html',
  styleUrls: ['./success-investment.component.scss'],
})
export class SuccessInvestmentComponent implements OnInit {
  // 组件数据
  @Input() tagData: any = {};
  // test: any = {
  //   "type": "tag",
  //   "style": "app-successExample-tag",
  //   "name": null,
  //   "linearLayout": "body",
  //   "data": {
  //     "image": "",
  //     "brandName": "火辣炸鸡",
  //     "amount": "成功开店361家",
  //     "year": "2018年跟铺铺旺合作",
  //     "title": "成功招商",
  //     "operation": {
  //       "link": {
  //         "type": "page",
  //         "params": {
  //           "aa": "aa"
  //         },
  //         "target": "59168"
  //       }
  //     }
  //   }
  // };
  cardData: any;



  constructor(private appGlobalService: AppGlobalService) { }

  ngOnInit() {
    this.cardData = this.tagData.data;
    console.log(this.tagData);
  }

  clickLink(obj) {
    if (!obj) {
      console.log('没有返回link-target');
    }
    const pageParams = {
      pageId: obj.target,
      params: obj.params,
      sessionId: localStorage.getItem('sessionId')
    };
    this.appGlobalService.goToForward(pageParams);
  }

}
